<!DOCTYPE HTML>
<html>
<head>
    {include file="../application/common/view/default/public/head.html"/}
    {load href="/ucenter/static/css/new-login.css" /}
</head>
<body>
    <div class="container">
        <div class="all-box">
            <div class="register-wrap">
                <p class="head">还没有账号?</p>
                <p>注册UCToo专属账号，或者偷懒使用第三方账号登录</p>
                {php}
                    $register_type=modC('REGISTER_TYPE','normal','Invite');
                    $register_type=explode(',',$register_type);
                    $only_open_register=0;
                    if(in_array('invite',$register_type)&&!in_array('normal',$register_type)){
                    $only_open_register=1;
                    }
                    $third=get_addons_status('SyncLogin');
                {/php}
                <script>
                    var ONLY_OPEN_REGISTER = "{$only_open_register}";
                </script>
                <a data-url="{:url('Ucenter/Member/register')}" data-role="do_register">
                    <div class="to-reg">
                    立即注册<i class="icon icon-circle-arrow-right"></i>
                    </div>
                </a>

                {if condition="$third eq 1" value="1" }
                    <div class="third-line"></div>
                <div class="third-login">
                    {:hook('syncLogin')}
                </div>
                {/if}
            </div>
            <form action="{:url('ucenter/Member/login')}" method="post" class="lg_lf_form ">
                <div class="login-wrap">
                    <p class="head">登 录</p>
                    <!--用户名输入-->
                    <div class="input-box">
                        <input type="text" id="inputEmail" placeholder="请输入账号" ajaxurl="/member/checkUserNameUnique.html" errormsg="{:lang('_MI_USERNAME_ERROR_')}" nullmsg="{:lang('_MI_USERNAME_')}" datatype="*4-32" value="" name="username" autocomplete="off">
                    </div>
                    <!--密码输入-->
                    <div class="input-box" id="password_block">
                        <input type="password" id="inputPassword" placeholder="{:lang('_NEW_PW_INPUT_')}" errormsg="{:lang('_PW_ERROR_')}" nullmsg="{:lang('_PW_INPUT_ERROR_')}" datatype="*6-30" name="password">
                        <i onclick="change_show(this)" class="icon-eye-open open-close"></i>
                    </div>
                    <!--验证码输入，如果开启-->
                    {if condition="check_verify_open('login')"}
                        <div class="input-box">
                            <input type="text" id="verifyCode"  placeholder="{:lang('_VERIFY_CODE_')}"
                                   errormsg="{:lang('_MI_CODE_NULL_')}" nullmsg="{:lang('_MI_CODE_NULL_')}" datatype="*5-5" name="verify">
                            <div class="code-box lg_lf_fm_verify">
                                <img class="verifyimg reloadverify  " alt="{:lang('_MI_ALT_')}" src="{:url('verify')}">
                            </div>
                            <div class="col-xs-11 Validform_checktip text-warning lg_lf_fm_tip col-sm-offset-1"></div>
                            <div class="clearfix"></div>
                        </div>
                    {/if}
                    <div class="clearfix form-group">
                        <div class="col-xs-6" style="padding-left: 0">
                            <label style="color: #848484;font-weight: normal">
                                <input type="checkbox" checked="checked" name="remember" value="1" style="cursor:pointer;">
                                {:lang('_REMEMBER_LOGIN_')}
                            </label>
                        </div>
                        {php}if(check_reg_type('email')||check_reg_type('mobile')){ {/php}
                        <div class="col-xs-6 text-right" style="padding-right: 0">
                            <div class=""><a class="" href="{:url('Member/mi')}"
                                             style="color: #848484;font-size: 12px;">{:lang('_FORGET_PW_')}{:lang('_QUESTION_')}</a>
                            </div>
                        </div>
                        {php} } {/php}
                    </div>

                    <div class="yes-wrap form-group text-right">
                        <a class="l-around" href="{:url('home/Index/index')}">随便看看</a>
                        <button type="submit" class="login-btn">{:lang('_LOGIN_SPACE_')}</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    {include file="../application/common/view/default/public/js.html"/}
    <script type="text/javascript">
        var quickLogin = "{$login_type}";
        $(document)
                .ajaxStart(function () {
                    $("button:submit").addClass("log-in").attr("disabled", true);
                })
                .ajaxStop(function () {
                    $("button:submit").removeClass("log-in").attr("disabled", false);
                });

        function change_show(obj) {
            if ($(obj).hasClass('icon-eye-open')) {
                var value = $('#inputPassword').val().trim();
                var html = '<input type="text" value="' + value + '" id="inputPassword"  placeholder="'+"{:lang('_NEW_PW_INPUT_')}"+'" errormsg="'+"{:lang('_PW_ERROR_')}"+'" nullmsg="'+"{:lang('_PW_INPUT_ERROR_')}"+'" datatype="*6-30" name="password">' +
                        '<i onclick="change_show(this)" class="icon-eye-close open-close">';
                $('#password_block').html(html);
            } else {
                var value = $('#inputPassword').val().trim();
                var html = '<input type="password" value="' + value + '" id="inputPassword"  placeholder="'+"{:lang('_NEW_PW_INPUT_')}"+'" errormsg="'+"{:lang('_PW_ERROR_')}"+'" nullmsg="'+"{:lang('_PW_INPUT_ERROR_')}"+'" datatype="*6-30" name="password">' +
                        '<i onclick="change_show(this)" class="icon-eye-open open-close">';
                $('#password_block').html(html);
            }
        }

        $(function () {
            $("form").submit(function () {
                toast.showLoading();
                var self = $(this);
                $.post(self.attr("action"), self.serialize(), success, "json");
                return false;
                function success(data) {
                    if (data.status) {
                        if (data.url==undefined&&quickLogin == "quickLogin") {
                            toast.success("{:lang('_WELCOME_RETURN_')}{:lang('_PERIOD_')}"+data.info, "{:lang('_TIP_GENTLE_')}");
                            setTimeout(function () {
                                window.location.reload();
                            }, 1500);
                        } else {
                            toast.success("{:lang('_WELCOME_RETURN_REDIRECTING_')}"+data.info, "{:lang('_TIP_GENTLE_')}");
                            setTimeout(function () {
                                window.location.href = data.url;
                            }, 1500);
                        }
                    } else {
                        toast.error(data.info, "{:lang('_TIP_GENTLE_')}");
                        //self.find(".Validform_checktip").text(data.info);
                        //刷新验证码
                        $(".reloadverify").click();
                    }
                    toast.hideLoading();
                }
            });
            var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function () {
                if (verifyimg.indexOf('?') > 0) {
                    $(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
                } else {
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
                }
            });
        });
    </script>
</body>
</html>